package cn.xd.itstack.springframework.beans.common;

import cn.xd.itstack.springframework.beans.bean.UserApplyPropertyValues;
import cn.xd.itstack.springframework.beans.factory.config.BeanPostProcessor;

/**
 * @Classname MyBeanPostProcessor
 * @Description TODO
 * @Date 2022/5/18 上午11:57
 * @Created by lvxiaodong
 */
public class MyBeanPostProcessor implements BeanPostProcessor {
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) {
        if ("userService".equals(beanName)) {
            UserApplyPropertyValues userService = (UserApplyPropertyValues) bean;
            userService.setLocation("改为：北京酒仙桥");
        }
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) {
        return bean;
    }
}
